#ifndef SHAPE__H
#define SHAPE__H

#include <iostream>

using namespace std;

#define MAX(i, j) ((i>j) ? i:j);

/*int MAX(int i, int j)				//Compilierfehler
	{
	return ((i > j) ? i : j);
	}*/

struct Rectangle
	{
	Rectangle(int x, int y, int w, int h)
		{
		column = x;
		row = y;
		columns = w;
		rows = h;
		}
	bool contains(int w, int h)
		{
		return column <= w && column+columns > w && row <= h && row+rows > h;
		}
	int column, row, columns, rows;
	};

class Shape
	{
	public:
		Shape(int c=0, int r=0, int cs=0, int rs=0)
			: _contour(c, r, cs, rs){}
		Shape(const Shape &s) : _contour(s._contour){};		//Copy-Constructor
		Shape& Shape::operator=(const Shape& s)		//Zuweisungsoperator
			{
			if (this==&s)
				return *this;
			_contour = s._contour;
			return *this;
			}
		virtual Rectangle getContour(){return _contour;}
		virtual char charAt(int i, int j) = 0;
		friend ostream& operator<< (ostream &os, Shape &shape) //output shape, row by row
			{
			Rectangle contour = shape.getContour();
			for(int j=contour.row; j < contour.row+contour.rows;j++)
				{
				for(int i=contour.column; i<contour.column+contour.columns; i++)
					{
					cout << shape.charAt(i-contour.column, j-contour.row);
					}
				os << endl;
				}
			return os;
			}
		virtual ~Shape(){}

	private:
		Rectangle _contour;
	};



#endif